This folder contains the R code used to generate the population mapping of ISRM Cells to U.S. Counties. 
This code took about 3 days to run on a single core on the FASRC Cluster.

1) Inputs required to run the code. a), b), and c) need to be downloaded. d) is provided with the code.
a)InMAP source-receptor matrix (ISRM) cells data. 
This dataset is available at: https://dx.doi.org/10.5281/zenodo.3590127
Accessed March 03, 2021
File: marginal_values_updated_110819.zip
Version: 1.2.1
File size: 12.9MB
Note: unlike the main model code, this code does not use/does not require the download of the full ISRM, only of this smaller file with summary cell data.

b) U.S. Census Bureau County Boundaries
This is the 2019 County TIGER/LINE shapefiles provided by the US Census Bureau
Available at: https://www2.census.gov/geo/tiger/TIGER2019/COUNTY/tl_2019_us_county.zip
Accessed March 05, 2021
File size: 76MB

c) U.S. Census Bureau Census Block Group Boundaries
These are the Block Group TIGER/LINE shapefiles provided by the US Census Bureau
Available as 56 .zip files in total one for each state/district/territory
Dataset files: 'tl_2019_[FIPS_ST_CODE]_bg.zip'
Where [FIPS_ST_CODE] is the FIPS state code for each state
Available at: https://www2.census.gov/geo/tiger/TIGER2019/BG/
Accessed March 05, 2021
File size: Approximately 640 MB in total (zipped). Over 1GB unzipped.

d) Additionally, we provide the U.S. Census Bureau (2019) 2015-2019 5-year population estimates from the American Community Survey (ACS), on a block group level. 
This is a model input required to run the code, and the file is found at Marginal_Damages_Model/InMAP_to_County_Population_Mapping/Inputs/USCB/BlockGroup_PopulationData/ACSDT5Y2019.B01003_data_with_overlays.csv
Source: [dataset] U.S. Census Bureau, 2019a. 2015-2019 American Community Survey 5-Year Estimates: variable B01003 (TOTAL POPULATION). https://data.census.gov/cedsci/advanced (accessed 21 February 2021).

2) Output
The output is the file Marginal_Damages_Model/InMAP_to_County_Population_Mapping/Outputs/InMAP_County_Overlay.RData. It is provided in the Output folder 
This file contains a single object named InMAP.Cells.by.County, which is used as an input in the marginal damages model file. 
In the main marginal damages model directory, this object was collected and saved in the same file as the other inputs used.

InMAP.Cells.by.County: This is a large matrix (3,108 x 52,411), where the 3,108 rows are the 3,108 counties and the 52,411 columns are the 52,411 InMAP cells (Goodkind et al., 2019b). Element Pij of this matrix (ith row and jth column) contains the percentage of population of county "i" in InMAP cell "j", i.e. 
Pij = Pj_in_i/Pi 

where Pj_in_i is the InMAP cell population that is located within the boundaries of county i; and Pi is the total population of county i.

Source:
We create this population mapping combining population data from the ISRM (Goodkind et al., 2019a, 2019b) and from the U.S. Census Bureau (2019a, 2019b). The U.S. Census Bureau (2019a) are 2015-2019 5-year population estimates from the American Community Survey (ACS), on a block group level. We combine it with the block group shapefiles from U.S. Census Bureau (2019b). 

References:
Goodkind, A.L., Tessum, C.W., Coggings, J.S., Hill, J.D., Marshall, J.D., 2019a. Fine-scale damage estimates of particulate matter air pollution reveal opportunities for location-specific mitigation of emissions. Proc. of the Natl. Acad. of Sci. of the U. S. A 116, 8775-8780. https://doi.org/10.1073/pnas.1816102116.

[dataset] Goodkind, A.L., Tessum, C.W., Coggings, J.S., Hill J.D., Marshall, J.D., 2019b. Data from “InMAP Source-Receptor Matrix (ISRM) dataset”. Zenodo. https://dx.doi.org/10.5281/zenodo.3590127 (accessed 03 March 2021). Deposited on 11 March 2019.

[dataset] U.S. Census Bureau, 2019a. 2015-2019 American Community Survey 5-Year Estimates: variable B1003 (TOTAL POPULATION). https://data.census.gov/cedsci/advanced (accessed 21 February 2021).

[dataset] U.S. Census Bureau, 2019b. Census TIGER/Line Shapefiles. https://www2.census.gov/geo/tiger/TIGER2019/BG/ (accessed 05 March 2021).

